/*
* This file is a part of the open-eBackup project.
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright (c) [2024] Huawei Technologies Co.,Ltd.
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*/
#ifndef BACKINT_H
#define BACKINT_H

#include <map>
#include <functional>
#include "ParseParamsBase.h"
#include "BackintConst.h"
#include "BackupHandler.h"
#include "InquireHandler.h"
#include "RestoreHandler.h"

namespace backint {
class BackintTool {
public:
    explicit BackintTool(const std::string version);
    ~BackintTool()
    {}
    uint32_t Run(int argc, char** argv);
private:
    uint32_t BackupMain(const StuParam &inParam);
    uint32_t RestoreMain(const StuParam &inParam);
    uint32_t InquireMain(const StuParam &inParam);
    uint32_t DeleteMain(const StuParam &inParam);
    uint32_t BackupForOracle(const StuParam &inParam);
private:
    std::string m_dirverPath;
    std::shared_ptr<ParseParamsBase> m_parseParamCls;
    std::string m_dbName;
    PlugParams m_plugParams;
    using BackintFunc = std::function<uint32_t(StuParam&)>;
    std::map<std::string, BackintFunc> m_backintFunMap;
    std::shared_ptr<BackupHandler> m_backupHanlder;
    std::shared_ptr<InquireHandler> m_inquireHanlder;
    std::shared_ptr<RestoreHandler> m_restoreHanlder;
};
}
#endif